import java.util.*;

// 1:无需package
// 2: 类名必须Main, 不可修改

/**
 * 23年第三题
 */
public class 阶乘 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        long n = scan.nextLong();
        List<Long> list = new ArrayList<>();
        Map<Long, Long> map = new HashMap<>();
        for (long i = 1; i <= n; i++) {
            list.add(scan.nextLong());
        }
        list.sort(Long::compare);
        for (long i = 1; i <= n; i++) {
            long a = list.get((int) i - 1);
            if (map.containsKey(a)) {
                map.put(a, map.get(a) + 1);
            } else {
                map.put(a, 1L);
            }
        }
        long max = list.get(0);
        while (true) {
            if (!map.containsKey(max)) {
                break;
            }
            long x = map.get(max);
            if (x % (max + 1) == 0) {
                if (map.containsKey(max + 1)) {
                    map.put(max + 1, map.get(max + 1) + x / (max + 1));
                } else {
                    map.put(max + 1, x / (max + 1));
                }
                max++;
            } else {
                break;
            }
        }
        System.out.println(max);
        scan.close();
    }
}